﻿@using NewLife.Common;
@using NewLife.Cube
@*@using XCode.Web*@
@{
    var set = NewLife.Cube.Setting.Current;
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="新生命团队,NewLife,魔方,Cube,XCode" />
    @*上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！*@
    <title>@ViewBag.Title - @SysConfig.Current.DisplayName</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon">

    <!-- 页面内联样式 -->
    @RenderSection("css", required: false)

    @if (set.BootstrapSelect)
    {
        <link rel="stylesheet" href="~/Content/bootstrap/css/bootstrap-multiselect.css">
    }

    <link rel="stylesheet" href="~/Content/DateTimePicker/bootstrap-datetimepicker.min.css">

    <link rel="stylesheet" href="~/Content/bootstrap-switch/bootstrap-switch.min.css">

    <!-- 最后引入基本样式 -->
    <link rel="stylesheet" href="~/Content/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="~/Content/bootstrap/css/font-awesome.min.css">

    <link rel="stylesheet" href="~/Content/bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="~/Content/bootstrap/css/bootstrap-responsive.min.css">

    <!-- 文本字体 -->
    <link rel="stylesheet" href="~/Content/ace/css/ace-fonts.min.css">
    <!-- ace 样式 -->
    <link rel="stylesheet" href="~/Content/ace/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style">
    @*artdialog style*@
    <link href="~/Content/artDialog/css/ui-dialog.css" rel="stylesheet" />

    <!-- 自定义样式 -->
    <link rel="stylesheet" href="~/Content/Cube.css?v=2.0.2017.1126">
    <!-- JQuery作为一等公民，页面内部随时可能使用 -->
    <script src="~/Content/js/jquery-2.1.3.min.js"></script>
</head>
<body>
    <div class="panel panel-default">
        <div class="breadcrumbs" id="breadcrumbs">
            <ul class="breadcrumb">
                @Html.PartialAsync("_Ace_Layout_Nav").Result
            </ul>
            <div style="float: right; margin-left: 40px;">@ViewBag.HeaderContent</div>
        </div>
        <div class="page-content">
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        @if (DbRunTimeModule.Enable)
        {
            <div class="panel-footer">
                @Html.Raw(DbRunTimeModule.GetInfo())
            </div>
        }
    </div>
    <!-- 最早引入基本脚本 -->
    <script src="~/Content/bootstrap/js/bootstrap.min.js"></script>
    @if (set.BootstrapSelect)
    {
        <script src="~/Content/bootstrap/js/bootstrap-multiselect.min.js"></script>
    }

    @RenderSection("scripts", required: false)

    <!--日历控件支持-->
    <script src="~/Content/DateTimePicker/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Content/DateTimePicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <script>
        $(function () {
            $('.form_datetime').each(function () {
                var df = $(this).attr('dateformat');
                if (!df) {
                    $(this).attr('dateformat', 'yyyy-mm-dd hh:ii:ss');
                    $(this).width(140);
                }
                else {
                    // 把C#标准格式化替换为控件格式
                    df = df.replace('mm', 'ii').replace('MM', 'mm').replace('HH', 'hh');
                    $(this).attr('dateformat', df);

                    // 根据时间日期格式，锁定日期输入框宽度
                    if (df.indexOf('hh') >= 0)
                        $(this).width(140);
                    else
                        $(this).width(80);
                }

                //根据日期格式自动推算日期选择view显示的范围
                var sv = 2;
                var mv = 2;
                var autoView = $(this).attr('autoView');
                if (autoView != 'false') {
                    df = $(this).attr('dateformat');
                    if (df.indexOf('ii') >= 0) {
                        mv = 0;
                        if (df.indexOf('dd') >= 0) {
                            sv = 2;
                        } else {
                            sv = 1;
                        }
                    } else if (df.indexOf('hh') >= 0) {
                        mv = 1;
                        if (df.indexOf('dd') >= 0) {
                            sv = 2;
                        } else {
                            sv = 1;
                        }
                    } else if (df.indexOf('dd') >= 0) {
                        mv = 2;
                        sv = 2;
                    } else if (df.indexOf('mm') >= 0) {
                        mv = 3;
                        sv = 3;
                    } else if (df.indexOf('yyyy') >= 0) {
                        mv = 4;
                        sv = 4;
                    }
                }

                $(this).attr('startview', sv);
                $(this).attr('minview', mv);
            });
            $("[dateformat]").each(function () {
                $(this).datetimepicker({
                    format: $(this).attr("dateformat"),
                    autoclose: true,
                    language: "zh-CN",
                    forceParse: false,
                    startView: parseInt($(this).attr('startview')),
                    minView: parseInt($(this).attr('minview'))
                });
            });
            @if (set.BootstrapSelect) {<text>
            $('.multiselect').each(function () {
                $(this).multiselect({
                    // 下拉列表仅在列表项比较多时显示过滤框
                    enableFiltering: $(this).children().length > 10,
                    buttonClass: 'btn btn-white btn-primary',
                    templates: {
                        button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>',
                        ul: '<ul class="multiselect-container dropdown-menu"></ul>',
                        filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
                        filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default btn-white btn-grey multiselect-clear-filter" type="button"><i class="fa fa-times-circle red2"></i></button></span>',
                        li: '<li><a href="javascript:void(0);"><label></label></a></li>',
                        divider: '<li class="multiselect-item divider"></li>',
                        liGroup: '<li class="multiselect-item group"><label class="multiselect-group"></label></li>'
                    },
                    filterPlaceholder: '搜索',
                    nonSelectedText: '无',
                    allSelectedText: '全选'
                });
            });
            </text>}
            @*双击跳转到form
            _List_Data_Action.cshtml变更
            @Html.ActionLink("编辑", "Edit", new { id = @Model },new{@class="editcell"})*@
            $('tr').dblclick(function () {
                var $this = $(this);
                var row = $this.closest("tr");
                var findcell = row.find('.editcell');
                if (findcell.length > 0) window.location.href = findcell.attr("href");
            });
        });
    </script>

    <!--开关插件-->
    <script src="~/Content/bootstrap-switch/bootstrap-switch.min.js"></script>
    <script>
        $(function () {
            $("input.chkSwitch").bootstrapSwitch();
        })
    </script>

    @*artDialog*@
    <script src="~/Content/artDialog/dist/dialog-plus-min.js"></script>
    <script src="~/Content/artDialog/dist/dialog.new.life.js"></script>
    @*模态窗Ajax删除提示*@
    <script src="~/Content/Cube.js?v=2.0.2017.1126"></script>
</body>
</html>